package com.xlt.activiti;

import com.xlt.activiti.bean.Holiday;
import com.xlt.activiti.group.ActivitiGroup;
import com.xlt.activiti.one.ActivitiCompleteTask;
import com.xlt.activiti.one.ActivitiDeployment;
import com.xlt.activiti.two.ActivitiAssigneeUEL;
import org.junit.Test;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/* 测试 */
public class ActivitiTwo {
    // 流程部署
    @Test
    public void deployment (){
        ActivitiDeployment
                .deployment("bpmn/holiday5.bpmn", "bpmn/holiday4.png");
    }

    // 根据 定义指定人员执行
    @Test
    public void startInstance(){
        // 3.创建流程实例
//        Map<String,Object> map = new HashMap<>();
//        map.put("assignee0","张三");
//        map.put("assignee1","李四");
//        map.put("assignee2","王五");
        ActivitiAssigneeUEL.assignee("holiday5",null);
    }

    @Test
    public void startInstanceByNum(){
        Holiday holiday = new Holiday();
        holiday.setName("张三");
        holiday.setNum(4.0f);
        holiday.setBeginTime(new Date());
        holiday.setEndTime(new Date());
        holiday.setReason("体检");
        holiday.setType("0");
        Map<String,Object> map = new HashMap<>();
        map.put("holiday",holiday);
        ActivitiAssigneeUEL.assignee("holiday_1",map);

    }

    // 任务完成
    @Test
    public void taskCompleteTask(){
        ActivitiCompleteTask.completeTask("holiday_1","人事");
    }

    // 任务完成加入id
    @Test
    public void taskCompleteTaskWitMap(){

    }

    // Assignee 任务查询
    @Test
    public void taskAssigneeSearch(){
       ActivitiGroup.taskAssigneeSearch("holiday5", "李四");
    }

    // CandidateUser 候选人查询
    @Test
    public void taskCandidateUserSearch(){
        ActivitiGroup.taskACandidateUserSearch("holiday5","李四");
    }

    // CandidateUser 候选人任务拾取
    @Test
    public void taskClaim(){
        ActivitiGroup.taskChaim("holiday5","李四");
    }

    @Test
    public void taskUnChaim(){
        ActivitiGroup.taskUnChaim("holiday5","李四");
    }

    @Test
    public void completeTask(){
        ActivitiGroup.completeTask("holiday5","赵六");
    }
}
